// JavaScript Document
function validate(){
	
	var subgr = document.getElementById('txtSubgr');
	var subject = document.getElementById('txtSubject');
	var grade = document.getElementById('txtGrade');
	var fee = document.getElementById('txtFee');
	
	    if(notEmpty(subgr, "Subject Code cannot be empty")){
			if(notEmpty(subject, "Subject cannot be empty")){
				if(notEmpty(grade, "Grade cannot be empty")){
					if(isNumeric(grade,"Grade Should be Numeric")){
			           if(notEmpty(fee, "Fee cannot be empty")){
	                          if(isNumeric(fee,"Fee Should be Numeric")){
					                   loadXMLDoc()
					 
							      }
							  return false;
							  }

					   return false;

					   }
				 return false;

				 }
				return false;

				}
		  return false;
		  }
	  return false;
	  }
	  
	  
	  function loadXMLDoc()
{


if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText;
	document.getElementById("myForm").reset(); 
	
    }
  }

    
    var subgr = document.getElementById('txtSubgr').value;
	var subject = document.getElementById('txtSubject').value;
	var grade = document.getElementById('txtGrade').value;
	var fee = document.getElementById('txtFee').value;
	
	var queryString ="?subgr=" + subgr +"&subject="+subject+ "&grade=" +grade +"&fee="+fee;
	
xmlhttp.open("GET","../logic/add/subject_code_add.php"+queryString ,true);
xmlhttp.send();
}

		function clearx()
{
	
	 document.getElementById("myForm").reset(); 
     document.getElementById("ajaxDiv").innerHTML="";
}
	  